package com.yeyks.model.enums;

/**
 * @author fuchangshuai
 * @date 2019/4/28 0028
 */
public enum ComfortEnum {

    //舒适度 1舒适 2高档 3豪华 4民宿专区
    HOMESTAY(1, "舒适"),
    THREESTAR(2, "高档"),
    FOURSTAR(3, "豪华"),
    FIVESTAR(4, "民宿专区");
    int value;
    String desc;

    ComfortEnum(int value, String desc) {
        this.value = value;
        this. desc = desc;
    }

    public Integer value() {
        return this.value;
    }
    public String desc() {
        return this.desc;
    }

    public static String getDesc(int value) {
        ComfortEnum[] comfortEnums = values();
        for (ComfortEnum comfortEnum : comfortEnums) {
            if (comfortEnum.value() == value) {
                return comfortEnum.desc();
            }
        }
        return null;
    }

    public static Integer getValue(String desc) {
        ComfortEnum[] comfortEnums = values();
        for (ComfortEnum comfortEnum : comfortEnums) {
            if (comfortEnum.desc().equals(desc)) {
                return comfortEnum.value();
            }
        }
        return null;
    }
}
